<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div style="z-index:10;background-color: white;
    position: fixed;top: 50%;left: 50%;
    margin-top:-100px;margin-left:-250px;
    height: 200px;width: 500px"></div>
<div style="z-index: 9;background-color: black;position: fixed;top: 0; right: 0;left: 0;bottom: 0;opacity: 0.5"></div>
<div style="width: 2000px;height: 2000px;background-color: green;overflow: auto">

</div>
</body>
</html>

<!--opacity: 0.5 #设置透明度-->
<!--z-index:10 #层级顺序，值越大，越上层-->